package static1;
//这是一个测试类

import java.util.ArrayList;

public class mainText {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();
//      Studenttext st = new Studenttext(); //Studenttext是私有类，直接new出该类型的对象是会报错的
        Student stu1 = new Student(18, "张三", "男");
        Student stu2 = new Student(21, "李四", "女");
        Student stu3 = new Student(11, "王五", "男");
        banwei bw = new banwei(18,"di","男","班委");//Student的子类
        bw.study();//子类调用父类的方法

        list.add(stu1);
        list.add(stu2);
        list.add(stu3);

        //获取年龄最大值
        int maxAge = Studenttext.getMaxAge(list);
        System.out.println(maxAge);
        //获取年龄最大的学生
        Student stu4 = Studenttext.getMaxStudent(list);
        System.out.println(stu4.getName() + " " + stu4.getAge() + " " + stu4.getSex());
    }
}
